package com.jzy.bxb.manage.controller;

import java.util.List;

import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.jzy.bxb.manage.service.OrderService;
import com.jzy.bxb.model.mongo.entity.Order;

/**
 * 小区
 * @author JiangZhiYong
 * QQ:359135103
 *
 */
@Controller
@RequestMapping("/order")
public class OrderController {
	private static final Logger LOGGER=LoggerFactory.getLogger(OrderController.class);

	@Autowired
	private OrderService orderService;
	
	/**
	 * 小区列表
	 * @param session
	 * @param response
	 * @return
	 */
	@RequestMapping(value="/list")
	public ModelAndView communityList(HttpSession session, HttpServletResponse response){
		try {
			List<Order> orders = orderService.getOrders();
			return new ModelAndView("/order", "orders", orders);
		} catch (Exception e) {
			LOGGER.error("小区",e);
			return new ModelAndView("redirect:/login");
		}
	}
	
}
